package com.jiangyg.mall.search.vo;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;

/**
 * 类描述：Sku 详情
 *
 * @author jiangyg
 * @version 4.0
 * @date 2022-12-05
 */
@Data
@NoArgsConstructor
@EqualsAndHashCode
public class SkuDetailsVO implements Serializable {

    private static final long serialVersionUID = 8988431222321371566L;

    /**
     * skuId
     */
    private String id;

    /**
     * 标题
     */
    private String title;

    /**
     * 副标题
     */
    private String subtitle;

    /**
     * 价格
     */
    private double price;

    /**
     * 商品介绍
     */
    private String introduce;

    /**
     * 品牌
     */
    private Brand brand;

    /**
     * 是否有库存
     */
    private boolean inStock;

    /**
     * 图片集
     */
    private List<Image> images;

    /**
     * 基础属性集合
     */
    private List<BaseAttr> baseAttrs;

    /**
     * 销售属性集合
     */
    private List<SaleAttr> saleAttrs;

    /**
     * 基本属性分组信息
     */
    private List<BaseAttrGroup> baseAttrGroups;

    /**
     * spuId
     */
    @JsonIgnore
    private transient String spuId;

    /**
     * 类描述：品牌
     */
    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    @EqualsAndHashCode
    public static class Brand implements Serializable {

        private static final long serialVersionUID = -1918551153128676227L;

        /**
         * 品牌ID
         */
        private String id;

        /**
         * 品牌名
         */
        private String name;

    }

    /**
     * 类描述：图片信息
     */
    @Data
    @NoArgsConstructor
    @EqualsAndHashCode
    @AllArgsConstructor
    public static class Image implements Serializable {

        private static final long serialVersionUID = -715619994070664925L;

        /**
         * 图片地址
         */
        private String url;

        /**
         * 是否默认
         */
        private boolean isDefault;

    }

    /**
     * 类描述：基础属性
     */
    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    @EqualsAndHashCode
    public static class BaseAttr implements Serializable {

        private static final long serialVersionUID = 4082702693139470176L;

        /**
         * 基础属性ID
         */
        private String id;

        /**
         * 基础属性名
         */
        private String name;

        /**
         * 基础属性值
         */
        private String value;

    }

    /**
     * 类描述：销售属性
     */
    @Data
    @NoArgsConstructor
    @EqualsAndHashCode
    public static class SaleAttr implements Serializable {

        private static final long serialVersionUID = -5704405210255713100L;

        /**
         * 销售属性ID
         */
        private String id;

        /**
         * 销售属性名
         */
        private String name;

        /**
         * 销售属性值集合
         */
        private List<SaleAttrValue> values;

    }

    /**
     * 类描述：销售属性值
     */
    @Data
    @NoArgsConstructor
    @EqualsAndHashCode
    public static class SaleAttrValue implements Serializable {

        private static final long serialVersionUID = 9016952815966201269L;

        /**
         * 销售属性值
         */
        private String value;

        /**
         * 对应的 skuId 集合
         */
        private List<String> skuIds;

    }

    /**
     * 类描述：属性分组
     */
    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    @EqualsAndHashCode
    public static class BaseAttrGroup implements Serializable {

        private static final long serialVersionUID = 214651825027065553L;

        /**
         * 分组ID
         */
        private String id;

        /**
         * 分组名称
         */
        private String name;

        /**
         * 分组图标
         */
        private String icon;

        /**
         * 属性ID集合
         */
        private List<String> attrIds;

    }

}
